<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>资金管理-会员余额</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link type="text/css" rel="stylesheet" href="css/style.css" />
    <script type="text/javascript" src="/EasyBuy/statics/js/jquery-1.8.2.min.js"></script>
     <script type="text/javascript" src="/EasyBuy/statics/js/jquery-1.4.2.min.js"></script>
    <script type="text/javascript" src="/EasyBuy/statics/js/menu.js"></script>    
	<script type="text/javascript" src="/EasyBuy/statics/js/select.js"></script>
	<script type="text/javascript">
		$(document).ready(function(){
			function select(){
				$.getJSON("BalanceServlet","opr=select&userid=2",selectCallBack);		//用户id死值
			}
			$(".money").attr("class","now");
			function selectCallBack(data){
				$("#fr").text("共发现"+data.length+"件");
				$("#fr").text("共发现"+data.length+"条");
				var $table=$("#table");
				var money=0;
				for(var i=0;i<data.length;i++){
					money+=data[i].money;
					$table.append("<tr><td>"+data[i].date+"</td><td>"+data[i].type+"</td><td>"+data[i].money+"</td><td>"+data[i].vipremarks+"</td><td>"+data[i].adminremarks+"</td><td><a class='delete' id='"+data[i].id+"'>删除</a></td></tr>");
				}
				
				//查询可用余额
				function selectBalance(){
					$.get("BalanceServlet","opr=selectBal",selectBalCallBack);
				}
				
				$(".delete").click(function (){
					var ts=confirm("确定要删除么?");
					if(ts==true){
						location.href="BalanceServlet?opr=delete&id="+this.id;
					}
				});		
			}
			select();
			
			
			
			
			function selectBalCallBack(data){
				var $table=$("#tabletr").parent();
				$table.append("<tr><td colspan='7' align='right'>您当前的可用资金为:￥"+data+"元</td></tr>");
			}
		});
	</script>
  </head>
  
  <body>
  	<c:choose>
	  	<c:when test="${empty applicationScope.id}">
	  		<% response.sendRedirect("/EasyBuy/pre/Login.jsp");%>
	  	</c:when>
	  	<c:otherwise>
	  		<%@ include file="../../common/header.jsp" %>
			<%@ include file="../../common/backendHeader.jsp" %>
			 <c:choose>
				<c:when test="${empty applicationScope.type }">
					<% 	request.getRequestDispatcher("../../UserServlet?opr=type&href=Member_Address&href1=order").forward(request, response); %>
				</c:when>
				<c:otherwise>
					<c:if test="${applicationScope.type==1 }">
		  				<%@ include file="../../common/sideMamber.jsp" %> 
					</c:if>
					<c:if test="${applicationScope.type==0 }">
						<%@ include file="../../common/sideUser.jsp" %> 
					</c:if>
				</c:otherwise>
			 </c:choose>
	  	</c:otherwise>
  	</c:choose>
  	
  	
		<div class="m_right">
            <p></p>			
            <div class="mem_tit">
            	<span class="fr" id="fr" style="font-size:12px; color:#55555; font-family:'宋体'; margin-top:5px;"></span>会员余额
            </div>
			<table id="table" border="0" class="ma_tab" style="width:930px; text-align:center; margin-bottom:30px;" cellspacing="0" cellpadding="0">
              <tr>
              	<td class="ma_a" colspan="7" align="right"><a href="backend/order/Member_Money_Charge.jsp">充值</a>|<a href="backend/order/Member_Cash.jsp">提现</a>|<a href="#">查看账户明细</a>|<a href="#">查看申请记录</a></td>
              </tr>
              <tr id="tabletr">                                                                                                                          
                <td width="230">操作时间</td>                                            
                <td width="70">类型</td>
                <td width="110">金额</td>
                <td width="130">会员备注</td>
                <td width="155">管理员备注</td>
                <td width="75">操作</td>
              </tr>
              
              <!-- <tr>
                <td colspan="7" align="right">您当前的可用资金为：￥0.00</td>
              </tr> -->
			</table>            
        </div>
	<%@ include file="../../common/footer.jsp" %>
  </body>
</html>
